home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume20 / psroff / part03 < prev    next >
Encoding:
Internet Message Format  |  1989-10-17  |  52.3 KB

  1. Subject:  v20i035:  Troff upgrade for PostScript, DiTroff compatibility, Part03/06
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: Chris Lewis <eci386!clewis@uunet.uu.net>
  7. Posting-number: Volume 20, Issue 35
  8. Archive-name: psroff/part03
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 3 (of 6)."
  17. # Contents:  Makefile cat.5 chartab.m dit2catwid.c fonts.lk ltest.m
  18. #   psxlate.c showfont.sh troff2ps.1
  19. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  20. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  21.   echo shar: Will not clobber existing file \"'Makefile'\"
  22. else
  23. echo shar: Extracting \"'Makefile'\" \(3689 characters\)
  24. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  25. X#    Copyright 1985, 1986, 1987, 1988 Chris Lewis
  26. X#        All Rights Reserved
  27. X#
  28. X#    Permission to copy and further distribute is freely given provided 
  29. X#    this copyright notice remains intact and that this software is not 
  30. X#    sold for profit.
  31. X#
  32. X#    Project:    Generic Troff drivers
  33. X#    Module:        Makefile
  34. X#    Author:     Chris Lewis
  35. X#    Specs:        Makefile for Generic Troff drivers
  36. X#    Note:        This is a System V Makefile, so you may
  37. X#            have some problems making a few of the items.
  38. X#
  39. X#ident  "@(#)Makefile: 1.33 Copyright 89/08/28 17:13:47 Chris Lewis"
  40. X
  41. X#    Set to where you want the user-interfaces to go
  42. XINDIR    = /usr/lbin
  43. X
  44. X#    Command to send the output from troff2
  45. X#    "rlp" is a local command for remote printing to an AppleLaser.
  46. X#    You will undoubtibly have to change this for your printers.
  47. X#    PLEASE NOTE: the print spooler you use *MUST* pass stuff
  48. X#    through unmodified - eg: no tab expansion, must be 8 bit (LJ with
  49. X#    font downloading - others should work with only 7 bit).
  50. X#    If you add a driver, please add an xxOUTPUT here:
  51. XPSOUTPUT    = | $(LIBDIR)/psxlate | rlp -dgate!AppleLaser -n$$copies
  52. X#    System V'ish printing to printer called laser, with no filtering
  53. XLJOUTPUT    = | lp -dlaser -og -n$$copies
  54. X#    Ditroff output
  55. XDTOUTPUT    = | /usr/lib/troff/tpscript | rlp -dgate!AppleLaser
  56. X#    Testing type:
  57. XTTYPE    = ps
  58. X
  59. X#    Libraries for Troff2 internals, created if it doesn't exist.
  60. XLIBDIR    = /usr/lib/troff2
  61. X
  62. X#    nroff/troff macro directory
  63. XTMACDIR    = /usr/lib/tmac
  64. X#    Where should the manual pages go?
  65. XMANDIR    = /usr/man/local/man1
  66. X
  67. X#    Comment this if you don't have shared libraries ala 386/ix
  68. XLIBFLAGS = -lc_s
  69. X
  70. XINSTALL    =    $(LIBDIR)/troff2ps $(INDIR)/psroff $(LIBDIR)/psxlate \
  71. X        $(TMACDIR)/tmac.t2 \
  72. X        $(MANDIR)/psroff.1 \
  73. X        $(MANDIR)/troff2ps.1 \
  74. X        $(LIBDIR)/lib.lj  $(LIBDIR)/fonts.lj \
  75. X        $(LIBDIR)/lib.lk $(LIBDIR)/fonts.lk \
  76. X        $(LIBDIR)/lib.dt  $(LIBDIR)/fonts.dt \
  77. X        $(LIBDIR)/lib.ps $(LIBDIR)/fonts.ps \
  78. X        $(LIBDIR)/confid.ps $(LIBDIR)/lethead.ps
  79. X
  80. XDEFINES    = '-DLIBDIR="$(LIBDIR)"'
  81. XCFLAGS    = $(DEFINES)
  82. X
  83. X.SUFFIXES: .ps .ps~ .lj .lj~ .1 .1~ .lk .lk~ .dt .dt~ .tst .prt .m .m~
  84. X
  85. X.lj~.lj:
  86. X    $(GET) $(GFLAGS) $<
  87. X
  88. X.m.prt:
  89. X    tbl $*.m | eqn | ./psroff -d$(TTYPE) -mt2 -
  90. X
  91. X.m.tst:
  92. X    tbl $*.m | eqn | ./psroff -d$(TTYPE) -t -mt2 - > $*.tst
  93. X
  94. X.m~.m:
  95. X    $(GET) $(GFLAGS) $<
  96. X
  97. X.dt~.dt:
  98. X    $(GET) $(GFLAGS) $<
  99. X
  100. X.lk~.lk:
  101. X    $(GET) $(GFLAGS) $<
  102. X
  103. X.1~.1:
  104. X    $(GET) $(GFLAGS) $<
  105. X
  106. X.ps~.ps:
  107. X    $(GET) $(GFLAGS) $<
  108. X
  109. XUTILLIST = troff2ps psroff psxlate tmac.t2 ltest.m chartab.m \
  110. X    psroff.1 troff2ps.1 \
  111. X    upload showfont \
  112. X    lib.ps lib.lj lib.lk \
  113. X    fonts.ps fonts.lj fonts.lk \
  114. X    confid.ps lethead.ps
  115. X
  116. Xall:    $(UTILLIST)
  117. X
  118. Xchartab.tst ltest.tst: troff2ps
  119. Xchartab.prt ltest.prt: troff2ps
  120. X
  121. Xchartab.tst ltest.tst: troff2ps
  122. Xchartab.prt ltest.prt: troff2ps
  123. X
  124. Xprtall:    ltest.prt chartab.prt
  125. Xtestall: ltest.tst chartab.tst
  126. X
  127. Xtroff2ps:    troff2.o utils.o t2conf.o lj.o ps.o lj.o ljtables.o dt.o
  128. X    $(CC) $(CFLAGS) -o troff2ps troff2.o t2conf.o utils.o \
  129. X        ps.o \
  130. X        dt.o \
  131. X        lj.o ljtables.o \
  132. X        $(LIBFLAGS)
  133. X
  134. X#    Drivers include dependencies - add to this list if you're adding
  135. X#    drivers.
  136. Xt2conf.o:    defs.h ps.h lj.h dt.h
  137. Xps.o:    defs.h ps.h
  138. Xlj.o ljtables.o:    defs.h lj.h
  139. Xdt.o:    defs.h dt.h
  140. X
  141. X#    Testing software:
  142. Xtestps.o:    defs.h ps.h
  143. X
  144. Xtroff2.o utils.o: defs.h
  145. X
  146. Xinstall:    $(LIBDIR) $(TMACDIR) $(INSTALL) fonts
  147. X
  148. Xfonts:    dit2catwid gfnttab
  149. X    su root -c "./gfnttab"
  150. X
  151. X$(INSTALL):    $$(@F)
  152. X    su root -c "cp $(@F) $@"
  153. X
  154. X$(LIBDIR) $(TMACDIR):
  155. X    su root -c "mkdir $@"
  156. X
  157. Xpsroff:    psroff.sh Makefile
  158. X    sed -e 's;%%LJOUTPUT%%;$(LJOUTPUT);g' \
  159. X        -e 's;%%PSOUTPUT%%;$(PSOUTPUT);g' \
  160. X        -e 's;%%DTOUTPUT%%;$(DTOUTPUT);g' \
  161. X        -e 's;%%LIBDIR%%;$(LIBDIR);g' \
  162. X        psroff.sh > T
  163. X    chmod 755 T
  164. X    mv T psroff
  165. X
  166. Xdeinstall:
  167. X    su root -c "rm -f $(INSTALL); rmdir $(LIBDIR)"
  168. X
  169. Xclean:
  170. X    rm -f core *.o $(UTILLIST) ltest.troff
  171. END_OF_FILE
  172. if test 3689 -ne `wc -c <'Makefile'`; then
  173.     echo shar: \"'Makefile'\" unpacked with wrong size!
  174. fi
  175. # end of 'Makefile'
  176. fi
  177. if test -f 'cat.5' -a "${1}" != "-c" ; then 
  178.   echo shar: Will not clobber existing file \"'cat.5'\"
  179. else
  180. echo shar: Extracting \"'cat.5'\" \(5349 characters\)
  181. sed "s/^X//" >'cat.5' <<'END_OF_FILE'
  182. X.\"@(#)cat.5 1.3 89/04/21 11:48:42 (Henry Spencer)
  183. X.TH CAT 5 local writeup
  184. X.DA 4 April 1981
  185. X.SH NAME
  186. Xcat \- C/A/T phototypesetter code
  187. X.SH DESCRIPTION
  188. XThe Graphic Systems C/A/T phototypesetter is driven by sending it a
  189. Xsequence of one-byte codes
  190. Xwhich specify characters, fonts, sizes, and other control information.
  191. X.PP
  192. XThe C/A/T's basic unit of length is 1/432 of an inch (6 units to a
  193. Xtypesetter's ``point'').
  194. XThe quantum of horizontal motion is one unit.
  195. XThe quantum of vertical motion is three units (1/144 of an inch, 1/2 point).
  196. X.PP
  197. XThe top two bits of the code classify it as one of three major
  198. Xtypes:
  199. Xan \fIescape\fR code (top bit 1),
  200. Xa \fIflash\fR code (top bits 00),
  201. Xor a control code (top bits 01).
  202. XA code of all zeros is ignored;  a code of all ones is illegal.
  203. X.PP
  204. XA flash code specifies flashing one of 63 characters, as given by the
  205. Xremaining six bits.
  206. XSince this is not enough to specify all possible characters, or even
  207. Xall characters in a single font \(em there are 108 per font \(em
  208. Xvarious control codes (described later) select a font and either
  209. Xthe Lower or Upper half of the font.
  210. XThe Lower half is the first 63 characters of the font;  the Upper
  211. Xhalf is the remaining 45.
  212. XA flash code of 46 or higher in the Upper half is illegal.
  213. X.PP
  214. XAn escape code specifies horizontal motion.
  215. XThe size of the motion, in horizontal quanta, is the one's-complement
  216. Xof the low seven bits of the code.
  217. XThe direction of the motion is set by control codes.
  218. XHitting the right or left margin limit switch is illegal and will
  219. Xcause the machine to stop.
  220. XThe machine starts out, after initialization, hard against the left
  221. Xmargin limit switch;  an initial escape of 16 units \fImust\fR
  222. Xbe given before starting work, and the position after this motion
  223. Xshould be the limit of all future leftward motions.
  224. XFrom this point, the distance to the right margin limit switch
  225. Xis about 7.5 inches.
  226. X.PP
  227. XA code with the top three bits 011 is a \fIlead\fR code,
  228. Xspecifying vertical motion.
  229. XThe remaining five bits are the one's-complement of the size of
  230. Xthe motion, in vertical quanta.
  231. XThe direction of motion is set by control codes.
  232. XThe amount of vertical motion is, in principle, limited only by
  233. Xrunning off the paper in the upward direction and by the limited
  234. Xcapacity of the output cartridge in the downward direction.
  235. X.PP
  236. XA code with the top four bits 0101 is a size-change code, which
  237. Xspecifies movement of the lens turret and the doubler lens to
  238. Xchange point size.
  239. XThese codes are as follows:
  240. X.PP
  241. X.RS
  242. X.nf
  243. X.ta 2c
  244. XSize    Code
  245. X
  246. X6    0101\|1000
  247. X7    0101\|0000
  248. X8    0101\|0001
  249. X9    0101\|0111
  250. X10    0101\|0010
  251. X11    0101\|0011
  252. X12    0101\|0100
  253. X14    0101\|0101
  254. X16    0101\|1001
  255. X18    0101\|0110
  256. X20    0101\|1010
  257. X22    0101\|1011
  258. X24    0101\|1100
  259. X28    0101\|1101
  260. X36    0101\|1110
  261. X.DT
  262. X.fi
  263. X.RE
  264. X.PP
  265. XSize changes involving the doubler lens alter the horizontal position.
  266. XChanges from single to double sizes should be followed by a forward
  267. Xescape of 55 quanta;  changes from double to single sizes should be
  268. Xfollowed by a reverse escape of 55 quanta.
  269. XThe single sizes are 6, 7, 8, 9, 10, 11, 12, 14, and 18;
  270. Xthe double sizes are 16, 20, 22, 24, 28, and 36.
  271. X.PP
  272. XThe control codes with the top four bits 0100 specify miscellaneous
  273. Xcontrol codes, not all of which have valid meanings.
  274. XThey are:
  275. X.PP
  276. X.RS
  277. X.ta 6c
  278. X.nf
  279. Xinitialize    0100\|0000
  280. Xstop    0100\|1001
  281. Xupper rail    0100\|0010
  282. Xlower rail    0100\|0001
  283. Xupper mag    0100\|0011
  284. Xlower mag    0100\|0100
  285. Xtilt up    0100\|1110
  286. Xtilt down    0100\|1111
  287. Xupper font half    0100\|0110
  288. Xlower font half    0100\|0101
  289. Xescape forward    0100\|0111
  290. Xescape backward    0100\|1000
  291. Xlead forward    0100\|1010
  292. Xlead backward    0100\|1100
  293. Xsoftware cut    0100\|1011
  294. X.fi
  295. X.DT
  296. X.RE
  297. X.PP
  298. XThe \fIinitialize\fR code causes leftward motion to the left margin limit
  299. Xswitch,
  300. Xand sets the following modes:
  301. Xescape forward, lead forward, lower font half,
  302. Xlower rail, lower mag, tilt down.
  303. XNote that the left margin limit switch does not define a precise
  304. Xposition, and hence reinitializing the machine
  305. Xwill destroy precise left-margin alignment.
  306. X.PP
  307. XThe \fIstop\fR code stops the machine, which must be manually
  308. Xrestarted (normally after changing output cartridges);
  309. Xthis code should be used only at the end of a run.
  310. X.PP
  311. XFonts are selected by the combination of \fIrail\fR, \fImag\fR, and \fItilt\fR.
  312. XThe tilt codes do not exist on the 4-font C/A/T;  this is the only user-visible
  313. Xdifference between the 4-font and 8-font machines.
  314. XThe correspondence between rail/mag/tilt and font number is as follows:
  315. X.PP
  316. X.RS
  317. X.nf
  318. X.ta 2c 4c 6c 8c
  319. Xrail    mag    tilt    4font    8font
  320. X
  321. Xlower    lower    up    1    1
  322. Xlower    lower    down    1    2
  323. Xupper    lower    up    2    3
  324. Xupper    lower    down    2    4
  325. Xlower    upper    up    3    5
  326. Xlower    upper    down    3    6
  327. Xupper    upper    up    4    7
  328. Xupper    upper    down    4    8
  329. X.DT
  330. X.fi
  331. X.RE
  332. X.PP
  333. XThe \fIsoftware cut\fR code should not be issued to the hardware, but
  334. Xis used by local spooling software to indicate places where it is
  335. Xlegal for the spooler to break output between pages.
  336. XThis code should be followed by an \fIinitialize\fR code.
  337. X.PP
  338. XA complete C/A/T file should begin with an \fIinitialize\fR code followed
  339. Xby an \fIescape\fR-16 code,
  340. Xand should end with 14 inches of trailer and a \fIstop\fR code.
  341. X.SH HISTORY
  342. XThe \fIsoftware cut\fR code is a local invention.
  343. XThis manual page written at U of T by Henry Spencer.
  344. X.SH BUGS
  345. XThe documentation and the hardware disagree on the initial tilt setting;
  346. Xthe above describes the hardware.
  347. X.PP
  348. XIt's not the fastest or most modern typesetter.
  349. END_OF_FILE
  350. if test 5349 -ne `wc -c <'cat.5'`; then
  351.     echo shar: \"'cat.5'\" unpacked with wrong size!
  352. fi
  353. # end of 'cat.5'
  354. fi
  355. if test -f 'chartab.m' -a "${1}" != "-c" ; then 
  356.   echo shar: Will not clobber existing file \"'chartab.m'\"
  357. else
  358. echo shar: Extracting \"'chartab.m'\" \(3287 characters\)
  359. sed "s/^X//" >'chartab.m' <<'END_OF_FILE'
  360. X.\"1.3 89/07/06
  361. X.lg 1
  362. X.DS
  363. X.TS
  364. Xallbox;
  365. Xcf3 p14 s s s s s
  366. Xc c c || c c c
  367. Xl l l || l l l.
  368. XMathematical and Other Characters
  369. X=
  370. Xcharacter    denotation    name    character    denotation    name
  371. X=
  372. X\(pl    \e(pl    math plus    \(ib    \e(ib    improper subset
  373. X\(mi    \e(mi    math minus    \(ip    \e(ip    improper superset
  374. X\(eq    \e(eq    math equal    \(if    \e(if    infinity
  375. X\(**    \e(**    math star    \(pd    \e(pd    partial derivative
  376. X\(sc    \e(sc    section    \(gr    \e(gr    gradient
  377. X\(aa    \e\(aa or \e(aa    acute accent    \(no    \e(no    not
  378. X\(ga    \e\(ga or \e(ga    grave accent    \(is    \e(is    integral sign
  379. X\(ul    \(ul or \e(ul    underrule    \(pt    \e(pt    proportional to
  380. X\(sl    \(sl or \e(sl    slash    \(es    \e(es    empty set
  381. X\(sr    \e(sr    square root    \(mo    \e(mo    member of
  382. X\(rn    \e(rn    root en    \(br    \e(br or |    box rule
  383. X\(>=    \e(>=    \(>=    \(dd    \e(dd    dbl dagger
  384. X\(<=    \e(<=    \(<=    \(rh    \e(rh    right hand
  385. X\(==    \e(==    equivalence    \(lh    \e(lh    left hand
  386. X\(~=    \e(~=    approx =    \(or    \e(or    or
  387. X\(ap    \e(ap    approximates    \(ci    \e(ci    circle
  388. X\(!=    \e(!=    not equal    \(lt    \e(lt    left top of big { and (
  389. X\(->    \e(->    right arrow    \(lb    \e(lb    left bot of big { and (
  390. X\(<-    \e(<-    left arrow    \(rt    \e(rt    right top of big } and )
  391. X\(ua    \e(ua    up arrow    \(rb    \e(rb    right bot of big } and )
  392. X\(da    \e(da    down arrow    \(lk    \e(lk    left ctr of big { and (
  393. X\(mu    \e(mu    multiply    \(rk    \e(rk    right ctr of big } and )
  394. X\(di    \e(di    divide    \(bv    \e(bv    bold vertical
  395. X\(+-    \e(+-    plus-minus    \(lf    \e(lf    left floor
  396. X\(cu    \e(cu    cup (union)    \(rf    \e(rf    right floor
  397. X\(ca    \e(ca    intersection    \(lc    \e(lc    left ceiling
  398. X\(sb    \e(sb    subset of    \(rc    \e(rc    right ceiling
  399. X\(sp    \e(sp    superset of    
  400. X.TE
  401. X.DE
  402. X.P
  403. XAlignment test:
  404. X.DS
  405. X\(sr\(rn
  406. X.DE
  407. X.P
  408. XLigatures:
  409. Xfido, floor, snaffle, suffix, shuffle.
  410. X.DS
  411. X.EQ
  412. Xsum from i=0 to {i= inf} x sup i
  413. X.EN
  414. X.EQ
  415. Xsqrt a+b + 1 over sqrt {ax sup 2 +bx+c}
  416. X.EN
  417. X.EQ
  418. Xsqrt {a sup 2 over b sub 2}
  419. X.EN
  420. X.TS
  421. Xallbox;
  422. Xcf3 p14 s s s s s
  423. Xc c c || c c c
  424. Xl l l || l l l.
  425. XGreek Characters
  426. X=
  427. Xcharacter    denotation    name    character    denotation    name
  428. X=
  429. X\(*a    \e(*a    alpha    \(*A    \e(*A    Alpha
  430. X\(*b    \e(*b    beta    \(*B    \e(*B    Beta
  431. X\(*g    \e(*g    gamma    \(*G    \e(*G    Gamma
  432. X\(*d    \e(*d    delta    \(*D    \e(*D    Delta
  433. X\(*e    \e(*e    epsilon    \(*E    \e(*E    Epsilon
  434. X\(*z    \e(*z    zeta    \(*Z    \e(*Z    Zeta
  435. X\(*y    \e(*y    eta    \(*Y    \e(*Y    Eta
  436. X\(*h    \e(*h    theta    \(*H    \e(*H    Theta
  437. X\(*i    \e(*i    iota    \(*I    \e(*I    Iota
  438. X\(*k    \e(*k    kappa    \(*K    \e(*K    Kappa
  439. X\(*l    \e(*l    lambda    \(*L    \e(*L    Lambda
  440. X\(*m    \e(*m    mu    \(*M    \e(*M    Mu
  441. X\(*n    \e(*n    nu    \(*N    \e(*N    Nu
  442. X\(*c    \e(*c    xi    \(*C    \e(*C    Xi
  443. X\(*o    \e(*o    omicron    \(*O    \e(*O    Omicron
  444. X\(*p    \e(*p    pi    \(*P    \e(*P    Pi
  445. X\(*r    \e(*r    rho    \(*R    \e(*R    Rho
  446. X\(*s    \e(*s    sigma    \(*S    \e(*S    Sigma
  447. X\(ts    \e(ts    terminal sigma    
  448. X\(*t    \e(*t    tau    \(*T    \e(*T    Tau
  449. X\(*u    \e(*u    upsilon    \(*U    \e(*U    Upsilon
  450. X\(*f    \e(*f    phi    \(*F    \e(*F    Phi
  451. X\(*x    \e(*x    chi    \(*X    \e(*X    Chi
  452. X\(*q    \e(*q    psi    \(*Q    \e(*Q    Psi
  453. X\(*w    \e(*w    omega    \(*W    \e(*W    Omega
  454. X.TE
  455. X.DE
  456. X.DS
  457. X.TS
  458. Xallbox;
  459. Xcf3 p14 s s s s s
  460. Xc c c || c c c
  461. Xl l l || l l l.
  462. XNon-ASCII Characters and minus on the Standard Fonts
  463. X=
  464. Xcharacter    denotation    name    character    denotation    name
  465. X=
  466. X\&`    \`    open quote    \(34    \e(34    3/4
  467. X\&'    \'    close quote    \(fi    \e(fi    fi
  468. X\&``    \`\`    open double quotes    \(fl    \e(fl    fl
  469. X\&''    \'\'    close double quotes    \(ff    \e(ff    ff
  470. X\(em    \e(em    3/4 em    \(Fi    \e(Fi    ffi
  471. X\(hy    \e(hy    - hyphen    \(Fl    \e(Fl    ffl
  472. X\-    \e-    minus    \(de    \e(de    degree
  473. X\(bu    \e(bu    bullet    \(dg    \e(dg    dagger
  474. X\(sq    \e(sq    square    \(fm    \e(fm    foot mark
  475. X\(ru    \e(ru    rule    \(ct    \e(ct    cent sign
  476. X\(14    \e(14    1/4    \(rg    \e(rg    registered
  477. X\(12    \e(12    1/2    \(co    \e(co    copyright
  478. X.TE
  479. X.DE
  480. X.S
  481. END_OF_FILE
  482. if test 3287 -ne `wc -c <'chartab.m'`; then
  483.     echo shar: \"'chartab.m'\" unpacked with wrong size!
  484. fi
  485. # end of 'chartab.m'
  486. fi
  487. if test -f 'dit2catwid.c' -a "${1}" != "-c" ; then 
  488.   echo shar: Will not clobber existing file \"'dit2catwid.c'\"
  489. else
  490. echo shar: Extracting \"'dit2catwid.c'\" \(8778 characters\)
  491. sed "s/^X//" >'dit2catwid.c' <<'END_OF_FILE'
  492. X/* Brute force ditroff to CAT width table converter 1.5 89/08/25
  493. X   Will generate ft* files that are compatible with troff (at least the
  494. X   Xenix version that is)
  495. X*/
  496. X
  497. Xstatic char SCCSid[] = "@(#)dit2catwid.c 1.5 89/08/25";
  498. X
  499. X#include <stdio.h>
  500. X#include "defs.h"
  501. X#include <ctype.h>
  502. Xint res = 720;
  503. Xint unitwid = 10;
  504. Xint symfont = 0;
  505. Xint verbose = 0;
  506. X
  507. X#define    TROFFUWID    6
  508. X
  509. X#ifdef    DEBUG
  510. X#undef    DEBUG
  511. X#endif
  512. X
  513. XFILE *mustopen();
  514. X
  515. Xstruct widths {
  516. X    char *name;
  517. X    unsigned char catwidth;
  518. X};
  519. X
  520. Xstruct widths symbol[256-32] = {
  521. X    {NULL},{NULL},             /* ".=Sw+042-40" */
  522. X    {"\""},
  523. X    {"#"},
  524. X    {NULL},{NULL},{NULL},{NULL},             /* ".=Sw+074-40" */
  525. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  526. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  527. X    {NULL},{NULL},{NULL},{NULL},
  528. X    {"<"},
  529. X    {NULL},             /* ".=Sw+076-40" */
  530. X    {">"},
  531. X    {NULL},             /* ".=Sw+100-40" */
  532. X    {"@"},
  533. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},        /* ".=Sw+134-40" */
  534. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  535. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  536. X    {NULL},{NULL},{NULL},{NULL},
  537. X    {"\\"},
  538. X    {NULL},             /* ".=Sw+136-40" */
  539. X    {"^"},
  540. X    {"_"},
  541. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  542. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  543. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  544. X    {NULL},{NULL},{NULL},
  545. X    {"}"},
  546. X    {NULL},             /* ".=Sw+175-40" */
  547. X    {"}"},
  548. X    {"~"},
  549. X    {NULL},             /* ".=Sw+220-40" */
  550. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  551. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  552. X    {"sc"},
  553. X    {NULL},            /* ".=Sw+222-40" */
  554. X    {"aa"},
  555. X    {"ga"},
  556. X    {"ul"},
  557. X    {"sl"},
  558. X    {NULL},         /* "" */
  559. X    {NULL},         /* "" */
  560. X    {"*a"},
  561. X    {"*b"},
  562. X    {"*g"},
  563. X    {"*d"},
  564. X    {"*e"},
  565. X    {"*z"},
  566. X    {"*y"},
  567. X    {"*h"},
  568. X    {"*i"},
  569. X    {"*k"},
  570. X    {"*l"},
  571. X    {"*m"},
  572. X    {"*n"},
  573. X    {"*c"},
  574. X    {"*o"},
  575. X    {"*p"},
  576. X    {"*r"},
  577. X    {"*s"},
  578. X    {"*t"},
  579. X    {"*u"},
  580. X    {"*f"},
  581. X    {"*x"},
  582. X    {"*q"},
  583. X    {"*w"},
  584. X    {"*G"},
  585. X    {"*D"},
  586. X    {"*H"},
  587. X    {"*L"},
  588. X    {"*C"},
  589. X    {"*P"},
  590. X    {"*S"},
  591. X    {NULL},         /* "" */
  592. X    {"*U"},
  593. X    {"*F"},
  594. X    {"*Q"},
  595. X    {"*W"},
  596. X    {"sr"},
  597. X    {"ts"},
  598. X    {"rn"},
  599. X    {">="},
  600. X    {"<="},
  601. X    {"=="},
  602. X    {"mi"},
  603. X    {"~="},
  604. X    {"ap"},
  605. X    {"!="},
  606. X    {"->"},
  607. X    {"<-"},
  608. X    {"ua"},
  609. X    {"da"},
  610. X    {"eq"},
  611. X    {"mu"},
  612. X    {"di"},
  613. X    {"+-"},
  614. X    {"cu"},
  615. X    {"ca"},
  616. X    {"sb"},
  617. X    {"sp"},
  618. X    {"ib"},
  619. X    {"ip"},
  620. X    {"if"},
  621. X    {"pd"},
  622. X    {"gr"},
  623. X    {"no"},
  624. X    {"is"},
  625. X    {"pt"},
  626. X    {"es"},
  627. X    {"mo"},
  628. X    {"pl"},
  629. X    {NULL},
  630. X    {NULL},
  631. X    {NULL},         /* "box vert rule (was 2.)" */
  632. X    {NULL},
  633. X    {"dd"},
  634. X    {"rh"},
  635. X    {"lh"},
  636. X    {"**"},
  637. X    {"bs"},
  638. X    {"or"},
  639. X    {"ci"},
  640. X    {"lt"},
  641. X    {"lb"},
  642. X    {"rt"},
  643. X    {"rb"},
  644. X    {"lk"},
  645. X    {"rk"},
  646. X    {"bv"},
  647. X    {"lf"},
  648. X    {"rf"},
  649. X    {"lc"},
  650. X    {"rc"}
  651. X};
  652. X
  653. Xstruct widths normal[256-32] = {
  654. X    {" "},
  655. X    {"!"},
  656. X    {NULL}, {NULL},
  657. X    {"$"},
  658. X    {"%"},
  659. X    {"&"},
  660. X    {"'"},
  661. X    {"("},
  662. X    {")"},
  663. X    {"*"},
  664. X    {"+"},
  665. X    {","},
  666. X    {"-"},        /* - hyphen - is this right? */
  667. X    {"."},
  668. X    {"/"},
  669. X    {"0"},
  670. X    {"1"},
  671. X    {"2"},
  672. X    {"3"},
  673. X    {"4"},
  674. X    {"5"},
  675. X    {"6"},
  676. X    {"7"},
  677. X    {"8"},
  678. X    {"9"},
  679. X    {":"},
  680. X    {";"},
  681. X    {NULL},
  682. X    {"="},
  683. X    {NULL},
  684. X    {"?"},
  685. X    {NULL},
  686. X    {"A"},
  687. X    {"B"},
  688. X    {"C"},
  689. X    {"D"},
  690. X    {"E"},
  691. X    {"F"},
  692. X    {"G"},
  693. X    {"H"},
  694. X    {"I"},
  695. X    {"J"},
  696. X    {"K"},
  697. X    {"L"},
  698. X    {"M"},
  699. X    {"N"},
  700. X    {"O"},
  701. X    {"P"},
  702. X    {"Q"},
  703. X    {"R"},
  704. X    {"S"},
  705. X    {"T"},
  706. X    {"U"},
  707. X    {"V"},
  708. X    {"W"},
  709. X    {"X"},
  710. X    {"Y"},
  711. X    {"Z"},
  712. X    {"["},
  713. X    {NULL},
  714. X    {"]"},
  715. X    {NULL},
  716. X    {NULL},
  717. X    {"`"},
  718. X    {"a"},
  719. X    {"b"},
  720. X    {"c"},
  721. X    {"d"},
  722. X    {"e"},
  723. X    {"f"},
  724. X    {"g"},
  725. X    {"h"},
  726. X    {"i"},
  727. X    {"j"},
  728. X    {"k"},
  729. X    {"l"},
  730. X    {"m"},
  731. X    {"n"},
  732. X    {"o"},
  733. X    {"p"},
  734. X    {"q"},
  735. X    {"r"},
  736. X    {"s"},
  737. X    {"t"},
  738. X    {"u"},
  739. X    {"v"},
  740. X    {"w"},
  741. X    {"x"},
  742. X    {"y"},
  743. X    {"z"},
  744. X    {NULL},
  745. X    {"|"},
  746. X    {NULL},
  747. X    {NULL},
  748. X    {"\\|"},    /* narrow space, not utterable in CAT troff? */
  749. X    {"hy"},
  750. X    {"bu"},
  751. X    {"sq"},
  752. X    {"em"},
  753. X    {"ru"},
  754. X    {"14"},
  755. X    {"12"},
  756. X    {"34"},
  757. X    {"-"},        /* - hyphen - is this right? */
  758. X    {"fi"},
  759. X    {"fl"},
  760. X    {"ff"},
  761. X    {"Fi"},
  762. X    {"Fl"},
  763. X    {"de"},
  764. X    {"dg"},
  765. X    {NULL},
  766. X    {"fm"},
  767. X    {NULL},
  768. X    {NULL},
  769. X    {NULL},
  770. X    {NULL},
  771. X    {"\\^"},    /* half narrow space, not utterable in troff? */
  772. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  773. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  774. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  775. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  776. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  777. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  778. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  779. X    {NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},{NULL},
  780. X    {NULL},{NULL},{NULL},{NULL},{NULL},
  781. X    {"rg"},
  782. X    {"co"},
  783. X    {NULL},
  784. X    {"ct"},
  785. X};
  786. X
  787. Xchar *progname;
  788. X
  789. Xmain(argc, argv)
  790. Xint argc; char **argv; {
  791. X    extern char *optarg;
  792. X    extern int optind;
  793. X    int c;
  794. X
  795. X    FILE *in1, *in2, *out;
  796. X    char *fin1, *fin2, *fout;
  797. X
  798. X    progname = argv[0];
  799. X
  800. X    while ((c = getopt(argc, argv, "vsr:u:")) != EOF)
  801. X    switch(c) {
  802. X        case 's':
  803. X        symfont = 1;
  804. X        break;
  805. X        case 'r':
  806. X        res = atoi(optarg);
  807. X        break;
  808. X        case 'u':
  809. X        unitwid = atoi(optarg);
  810. X        break;
  811. X        case 'v':
  812. X        verbose = 1;
  813. X        break;
  814. X        default:
  815. X        usage();
  816. X    }
  817. X    if (optind != argc - 3) {
  818. X    usage();
  819. X    }
  820. X    in1 = mustopen(fin1 = argv[optind], "r");
  821. X    in2 = mustopen(fin2 = argv[optind+1], "r");
  822. X    out = mustopen(fout = argv[optind+2], "w");
  823. X    process(in1, fin1);
  824. X    process(in2, fin2);
  825. X    if (symfont)
  826. X    output(symbol, out, fout, "Symbol character set");
  827. X    else
  828. X    output(normal, out, fout, "Normal character set");
  829. X    fclose(in1);
  830. X    fclose(in2);
  831. X    fclose(out);
  832. X    exit(0);
  833. X}
  834. X
  835. Xoutput(symset, f, file, type)
  836. XFILE *f;
  837. Xstruct widths *symset;
  838. Xchar *type, *file; {
  839. X    int i;
  840. X    for (i = 0; i < 224; i++) {
  841. X    if (symset[i].name && !symset[i].catwidth) {
  842. X        fprintf(stderr, "%s: No width for %s (file %s)\n",
  843. X        progname, symset[i].name, file);
  844. X        fputc(normal[0].catwidth, f);
  845. X    } else
  846. X        fputc(symset[i].catwidth, f);
  847. X    }
  848. X    if (verbose) {
  849. X    for (i = 0; i < 224; i++) {
  850. X        printf("    %d+%03o,",
  851. X        symset[i].catwidth & 077, symset[i].catwidth & 0300);
  852. X        if (symset[i].name)
  853. X        printf ("    /* \"%s\" */\n", symset[i].name);
  854. X        else
  855. X        printf ("\n");
  856. X    }
  857. X    }
  858. X}
  859. X
  860. Xusage() {
  861. X    fprintf(stderr, "usage: %s [-rres] [-uunitwid] normfont symfont output\n",
  862. X    progname);
  863. X    exit(1);
  864. X}
  865. X
  866. XFILE *
  867. Xmustopen(f, mode)
  868. Xchar *f, *mode; {
  869. X    FILE *desc;
  870. X    if ((desc = fopen(f, mode)) == NULL) {
  871. X    fprintf(stderr, "%s: cannot open file %s mode %s\n", progname, f, mode);
  872. X    exit(1);
  873. X    } else
  874. X    return(desc);
  875. X}
  876. X
  877. Xchar *gettoken();
  878. X
  879. Xprocess(f, filename)
  880. XFILE *f;
  881. Xchar *filename; {
  882. X    char *sv;
  883. X    char buffer[512];
  884. X    char *tok;
  885. X    int commentsok = 1;
  886. X    int widval, oldwidval;
  887. X    while(fgets(buffer, sizeof(buffer), f) && buffer[0] == '#');
  888. X    while(fgets(buffer, sizeof(buffer), f)) {
  889. X    tok = gettoken(buffer, NULL);
  890. X
  891. X    if (!tok)
  892. X        continue;
  893. X    if (0 == strcmp(tok, "charset"))
  894. X        break;
  895. X
  896. X    if (0 == strcmp(tok, "spacewidth")) {
  897. X        if (!(tok = gettoken(buffer, 1))) {
  898. X        fprintf(stderr, "%s: bad spacewidth line in %s\n",
  899. X            progname, filename);
  900. X        exit(1);
  901. X        }
  902. X        widval = atoi(tok);
  903. X        widval = (TROFFUWID * TROFFRESOLUTION * widval / (unitwid * res));
  904. X        update(symbol, " ", widval);
  905. X        update(normal, " ", widval);
  906. X        update(symbol, "narrow space", widval / 2);
  907. X        update(normal, "narrow space", widval / 2);
  908. X        update(symbol, "half narrow space", widval / 4);
  909. X        update(normal, "half narrow space", widval / 4);
  910. X    }
  911. X    }
  912. X    if (strcmp(tok, "charset")) {
  913. X    fprintf(stderr, "%s: %s bad format - no charset line\n", progname,
  914. X        filename);
  915. X    exit(1);
  916. X    }
  917. X    while(fgets(buffer, sizeof(buffer), f)) {
  918. X    char str[3];
  919. X    if (commentsok && buffer[0] == '#')
  920. X        continue;
  921. X    commentsok = 0;
  922. X#ifdef    DEBUG
  923. X    printf("buffer: %s\n", buffer);
  924. X#endif
  925. X    tok = gettoken(buffer, NULL);
  926. X    if (!tok)
  927. X        continue;
  928. X    if (strlen(tok) > 2) {
  929. X        fprintf(stderr, "%s: %s bad format on line %s\n",
  930. X        progname, filename, buffer);
  931. X        exit(1);
  932. X    }
  933. X    strcpy(str, tok);
  934. X    tok = gettoken(buffer, 1);
  935. X    if (!tok) {
  936. X        fprintf(stderr, "%s: %s bad format on line %s\n",
  937. X        progname, filename, buffer);
  938. X        exit(1);
  939. X    }
  940. X#ifdef    DEBUG
  941. X    printf("token: %s\n", tok);
  942. X#endif
  943. X    if (0 == strcmp(tok, "\""))
  944. X        widval = oldwidval;
  945. X    else {
  946. X        widval = (TROFFUWID * TROFFRESOLUTION * atoi(tok) / (unitwid * res));
  947. X        tok = gettoken(buffer, 1);
  948. X        if (!tok) {
  949. X        fprintf(stderr, "%s: %s bad format on line %s\n",
  950. X            progname, filename, buffer);
  951. X        exit(1);
  952. X        }
  953. X        widval |= (atoi(tok) << 6);
  954. X    }
  955. X    update(symbol, str, widval);
  956. X    update(normal, str, widval);
  957. X    oldwidval = widval;
  958. X    }
  959. X}
  960. X
  961. Xupdate(table, str, val)
  962. Xstruct widths *table;
  963. Xchar *str;
  964. Xint val; {
  965. X    int i;
  966. X
  967. X#ifdef    DEBUG
  968. X    printf("Inserting char %s, (%03o)\n", str, val);
  969. X#endif
  970. X
  971. X    for (i = 0; i < 224; i++)
  972. X    if (0 == strcmp(table[i].name, str))
  973. X        table[i].catwidth = val;
  974. X}
  975. X
  976. Xchar *
  977. Xgettoken(buf, ptr)
  978. Xchar *buf, *ptr; {
  979. X    static char *saveptr;
  980. X    static char savebuf[512];
  981. X    char *bp = savebuf;
  982. X    if (!ptr)
  983. X    saveptr = buf;
  984. X    while(*saveptr && isspace(*saveptr)) saveptr++;
  985. X    if (*saveptr)
  986. X    while(*saveptr && !isspace(*saveptr))
  987. X        *bp++ = *saveptr++;
  988. X    *bp = '\0';
  989. X    if (savebuf[0])
  990. X    return(savebuf);
  991. X    else
  992. X    return((char *) NULL);
  993. X}
  994. END_OF_FILE
  995. if test 8778 -ne `wc -c <'dit2catwid.c'`; then
  996.     echo shar: \"'dit2catwid.c'\" unpacked with wrong size!
  997. fi
  998. # end of 'dit2catwid.c'
  999. fi
  1000. if test -f 'fonts.lk' -a "${1}" != "-c" ; then 
  1001.   echo shar: Will not clobber existing file \"'fonts.lk'\"
  1002. else
  1003. echo shar: Extracting \"'fonts.lk'\" \(3271 characters\)
  1004. sed "s/^X//" >'fonts.lk' <<'END_OF_FILE'
  1005. X#@(#)fonts.lk 1.2 89/06/14
  1006. X               +------------------------------------ Symbol set
  1007. X               |      +----------------------------- 0=fixed, 1=proportional
  1008. X               |      | +--------------------------- 0=upright, 1=italics
  1009. X               |      | |  +------------------------ stroke weight -7...7
  1010. X               |      | |  |  +--------------------- Typeface
  1011. X               |      | |  |  |
  1012. X               |      | |  |  |
  1013. X               v      v v  v  v    */
  1014. X/* A*/    "\033(0U\033(s1p0s00b05T",    /* Times-Roman */
  1015. X/* B*/    "\033(0U\033(s1p1s-3b05T",    /* Times-Italic */
  1016. X/* C*/    "\033(0U\033(s1p0s03b05T",    /* Times-Bold */
  1017. X/* D*/    "\033(0E\033(s0p0s00b03T",    /* Math Symbol (actually Roman Ext.) */
  1018. X/* E*/    "\033(0U\033(s1p1s03b05T",    /* Times-BoldItalic */
  1019. X/* F*/    "\033(0U\033(s0p0s00b03T",    /* Courier */
  1020. X/* G*/    "\033(0U\033(s0p1s-3b03T",    /* Courier-Oblique */
  1021. X/* H*/    "\033(0U\033(s0p0s03b03T",    /* Courier-Bold */
  1022. X    /*
  1023. X     * These are for special characters that aren't in the symbol font
  1024. X     * The are in the HP 'K' font cartridge ?
  1025. X     */
  1026. X/* I*/    "\033(0Q\033(s0p0s00b03T",    /* Math 8a */
  1027. X/* J*/    "\033(1Q\033(s0p0s00b03T",    /* Math 8b */
  1028. X/* K*/    "\033(0A\033(s0p0s00b03T",    /* Math 7 */
  1029. X/* L*/    "\033(2Q\033(s0p0s00b03T",    /* PiFonta */
  1030. X/* M*/    "\033(8U\033(s0p0s00b00T",    /* LinePrinter */
  1031. X/* N*/    "\033(8U\033(s0p1s-3b00T",    /* LinePrinter-Italic */
  1032. X/* O*/    "\033(8U\033(s0p0s03b00T",    /* LinePrinter-Bold */
  1033. X    /*
  1034. X     * rest currently unsupported
  1035. X     */
  1036. X/* P    "\033(8U\033(s1p0s00b01T",    /* Pica */
  1037. X/* Q    "\033(8U\033(s1p1s-3b01T",    /* Pica-Italic */
  1038. X/* R    "\033(8U\033(s1p0s03b01T",    /* Pica-Bold */
  1039. X/* S    "\033(8U\033(s1p0s00b02T",    /* Elite */
  1040. X/* T    "\033(8U\033(s1p1s-3b02T",    /* Elite-Italic */
  1041. X/* U    "\033(8U\033(s1p0s03b02T",    /* Elite-Bold */
  1042. X/* V    "\033(8U\033(s1p0s00b04T",    /* Helvette */
  1043. X/* W    "\033(8U\033(s1p1s-3b04T",    /* Helvette-Italic */
  1044. X/* X    "\033(8U\033(s1p0s03b04T",    /* Helvette-Bold */
  1045. X
  1046. X/* Y    "\033(8U\033(s1p0s00b06T",    /* Gothic */
  1047. X/* Z    "\033(8U\033(s1p1s-3b06T",    /* Gothic-Italic */
  1048. X/*    "\033(8U\033(s1p0s03b06T",    /* Gothic-Bold */
  1049. X/*     "\033(8U\033(s1p0s00b07T",    /* Script */
  1050. X/*    "\033(8U\033(s1p1s-3b07T",    /* Script-Italic */
  1051. X/*    "\033(8U\033(s1p0s03b07T",    /* Script-Bold */
  1052. X/*    "\033(8U\033(s1p0s00b08T",    /* Prestige */
  1053. X/*    "\033(8U\033(s1p1s-3b08T",    /* Prestige-Italic */
  1054. X/*    "\033(8U\033(s1p0s03b08T",    /* Prestige-Bold */
  1055. X/*    "\033(8U\033(s1p0s00b09T",    /* Caslon */
  1056. X/*    "\033(8U\033(s1p1s-3b09T",    /* Caslon-Italic */
  1057. X/*    "\033(8U\033(s1p0s03b09T",    /* Caslon-Bold */
  1058. X/*    "\033(8U\033(s1p0s00b10T",    /* Orator */
  1059. X/*    "\033(8U\033(s1p1s-3b10T",    /* Orator-Italic */
  1060. X/*    "\033(8U\033(s1p0s03b10T",    /* Orator-Bold */
  1061. X
  1062. X/*    "\033(8M\033(s1p0s00b05T",    /* Math-8 Symbol */
  1063. X/*    "\033(10N\033(s1p0s00b05T",    /* US Symbol */
  1064. X};
  1065. X
  1066. Xstatic
  1067. Xchar *fontNames[LASTFONT-'A'+1] = {
  1068. X    "Times-Roman",            /* default font (1:A) */
  1069. X    "Times-Italic",            /* default font (2:B) */
  1070. X    "Times-Bold",            /* default font (3:C) */
  1071. X    "Symbol",            /* default font (4:D) */
  1072. X    "Times-BoldItalic",        /* font E */
  1073. X    "Courier",            /* font F */
  1074. X    "Courier-Oblique",        /* font G */
  1075. X    "Courier-Bold",            /* font H */
  1076. X    "Math 8a",            /* font I */
  1077. X    "Math 8b",            /* font J */
  1078. X    "Math 7",            /* font K */
  1079. X    "PiFonta",            /* font L */
  1080. X    "LinePrinter",            /* font M */    /* only 16.66 fixed */
  1081. X    "LinePrinter-Italic",        /* font N */
  1082. X    "LinePrinter-Bold",        /* font O */
  1083. X};
  1084. END_OF_FILE
  1085. if test 3271 -ne `wc -c <'fonts.lk'`; then
  1086.     echo shar: \"'fonts.lk'\" unpacked with wrong size!
  1087. fi
  1088. # end of 'fonts.lk'
  1089. fi
  1090. if test -f 'ltest.m' -a "${1}" != "-c" ; then 
  1091.   echo shar: Will not clobber existing file \"'ltest.m'\"
  1092. else
  1093. echo shar: Extracting \"'ltest.m'\" \(8315 characters\)
  1094. sed "s/^X//" >'ltest.m' <<'END_OF_FILE'
  1095. X.\"Document revision 1.12 89/08/25
  1096. X.nr Ej 1
  1097. X.TL
  1098. Xtroff2ps testing script.
  1099. X.AU "Chris Lewis"
  1100. X.AS 1 10
  1101. XEver since the dawn of time, people have been dreaming of being
  1102. Xable to use "troff" on devices other than Wang Cat Phototypesetters.
  1103. XThis is a test document of one such thingie.
  1104. X.AE
  1105. X.MT 4 1
  1106. X.SP 2i
  1107. X.H 1 "Line Test"
  1108. X.P
  1109. XThis line should be exactly 5 inches long:
  1110. X.DS
  1111. X\l'5i\&\(ru'
  1112. X.DE
  1113. X.H 2 "Extended font test"
  1114. X.P
  1115. XExtended font test:
  1116. X.eX I
  1117. XThis is a standard display - this should be 
  1118. XCourier, fixed width.
  1119. X.eE
  1120. X.H 2 "Simple paragraphs"
  1121. X.P
  1122. XThis is some more of the testing.  Can't you tell?
  1123. XTesting, testing, testing testing.
  1124. XThis book is a practical guide to the \fBUNIX\fP system and all users 
  1125. Xfrom the novice to the expert should find it useful.
  1126. XMany examples are used throughout the text to illustrate techniques that make
  1127. Xthe system attractive to use.  By giving examples of the interactions
  1128. Xbetween commands, the user is able to take full advantage of the power of the
  1129. X\fBUNIX\fP system.
  1130. X.P
  1131. XThis is some more of the testing.  Can't you tell?
  1132. XTesting, testing, testing testing.
  1133. XThis book is a practical guide to the \fBUNIX\fP system and all users 
  1134. Xfrom the novice to the expert should find it useful.
  1135. XMany examples are used throughout the text to illustrate techniques that make
  1136. Xthe system attractive to use.  By giving examples of the interactions
  1137. Xbetween commands, the user is able to take full advantage of the power of the
  1138. X\fBUNIX\fP system.
  1139. X.H 1 "Lists"
  1140. X.P
  1141. XBullet list:
  1142. X.BL
  1143. X.LI
  1144. X\(<- that was a bullet.
  1145. X.LI
  1146. XThis is 2
  1147. X.LI
  1148. XDashlist:
  1149. X.DL
  1150. X.LI
  1151. XDash
  1152. X.LI
  1153. XDasher
  1154. X.LE
  1155. X.LE
  1156. X.H 2 "Ligature test"
  1157. X.P
  1158. XLigature test: fido, flu, duffle, duffin
  1159. X.P
  1160. Xnroff doesn't like double quotes too much.
  1161. X"X" should look reasonable.
  1162. XMore 'test` `test'\*F
  1163. X.FS
  1164. XThis here's a footnote - slightly smaller pitch.
  1165. X.FE
  1166. XThis is more of the paragraph.
  1167. X.SK
  1168. X.H 1 "Different Fonts"
  1169. X.P
  1170. XThis is normal\f3Bold\fP\f2italic\fPnormal.
  1171. XThis is normal \f3Bold\fP \f2italic\fP normal.
  1172. X.S 36 38
  1173. X.P
  1174. X\(bs
  1175. X.S
  1176. X.S 14 26
  1177. X.P
  1178. Xthat was the logo at 36 point.  This sentence is 14 point.
  1179. X.S
  1180. X.P
  1181. XThe Logo will be printed whether or not you have raster fonts.
  1182. XThe original logo is a stylized "cX".
  1183. XIf you don't have the vfonts installed, the rest of the line will be
  1184. Xnormal characters with big spacing.
  1185. XIf the fonts are installed, you will see 75DPI big print.
  1186. X.P
  1187. XThis is some more of bigger stuff:
  1188. X.S 22
  1189. XTesting
  1190. X.I Testing
  1191. X.B Testing
  1192. X.S
  1193. X.SP
  1194. X.S 6
  1195. X6 Point
  1196. X.br
  1197. X.S 7
  1198. X7 Point
  1199. X.br
  1200. X.S 8
  1201. X8 Point
  1202. X.br
  1203. X.S 9
  1204. X9 Point
  1205. X.br
  1206. X.S 10
  1207. X10 Point
  1208. X.br
  1209. X.S 11
  1210. X11 Point
  1211. X.br
  1212. X.S 12
  1213. X12 Point
  1214. X.br
  1215. X.S 14
  1216. X14 Point
  1217. X.br
  1218. X.S 16
  1219. X16 Point
  1220. X.br
  1221. X.S 18
  1222. X18 Point
  1223. X.br
  1224. X.S 20
  1225. X20 Point
  1226. X.br
  1227. X.S 22
  1228. X22 Point
  1229. X.br
  1230. X.S 24
  1231. X24 Point
  1232. X.br
  1233. X.S 28
  1234. X28 Point
  1235. X.br
  1236. X.S 36
  1237. X36 Point
  1238. X.br
  1239. X.S 10
  1240. X.P
  1241. XNow, lets have some phun with phonts:
  1242. X.br
  1243. X.fp 1 H
  1244. X.fp 2 HO
  1245. X.fp 3 HB
  1246. X.ft 1
  1247. XThis should be Helvetica.
  1248. X\f2Helvetica Oblique\fP, \f3Helvetica Bold\fP.
  1249. X.br
  1250. X.fp 1 BR
  1251. X.fp 2 BO
  1252. X.fp 3 BB
  1253. X.ft 1
  1254. X.P
  1255. XThis should be Bookman.
  1256. X\f2Bookman Oblique\fP, \f3Bookman Bold\fP.
  1257. X.br
  1258. X.fp 1 R
  1259. X.fp 2 I
  1260. X.fp 3 B
  1261. X.H 3 "Testing 3"
  1262. Xhello 3
  1263. X.H 4 "Testing 4"
  1264. Xhello 4
  1265. X.H 5 "Testing 5"
  1266. Xhello 5
  1267. X.H 6 "Testing 6"
  1268. Xhello 6
  1269. X.H 7 "Testing 7"
  1270. Xhello 7
  1271. X.H 1 "Some Equations"
  1272. X.S 16
  1273. XEquations:
  1274. X.S
  1275. X.DS
  1276. X.EQ
  1277. Xleft [ x sup 2 + y sup 2 over alpha right ] ~=~ 1
  1278. X.EN
  1279. X.DE
  1280. X.br
  1281. X.DS
  1282. X.EQ
  1283. Xx dot = f(t) bar
  1284. X.EN
  1285. X.DE
  1286. X.DS
  1287. X.EQ
  1288. Xlim from {n -> inf} sum from 0 to n x sub i
  1289. X.EN
  1290. X.DE
  1291. X.DS
  1292. X.EQ
  1293. Xt ~=~ 2 pi int sub 0 sup 1
  1294. Xsin ( sqrt { x sup 2 + a sup 2 } ) dx
  1295. X.EN
  1296. X.DE
  1297. X.\".P
  1298. X.\"This is a test of piling (though, this isn't eqn):
  1299. X.\".DS I
  1300. X.\"\b'\(lt\(lk\(lb'\b'\(lc\(lf x \b'\(rc\(rf\b'\(rt\(rk\(rb'
  1301. X.\".DE
  1302. X.H 2 "More Equations"
  1303. X.DS
  1304. X.EQ
  1305. XG(z)~mark =~ e sup { ln ~ G(z) }
  1306. X~=~ exp left (
  1307. Xsum from k>=1 { S sub k z sup k } over k right )
  1308. X~=~ prod from k>=1 e sup { S sub k z sup k / k }
  1309. X.EN
  1310. X.DE
  1311. X.DS
  1312. X.EQ
  1313. Xlineup = left ( 1 + S sub 1 z +
  1314. X{ S sub 1 sup 2 z sup 2 } over 2! + ... right )
  1315. Xleft ( 1 + { S sub 2 z sup 2 } over 2
  1316. X+ { S sub 2 sup 2 z sup 4 } over { 2 sup 2 cdot 2! }
  1317. X+ ... right ) ...
  1318. X.EN
  1319. X.DE
  1320. X.DS
  1321. X.EQ
  1322. Xlineup = sum from m>=0 left (
  1323. Xsum from
  1324. Xpile { k sub 1 ,k sub 2 ,..., k sub m >= 0
  1325. Xabove
  1326. Xk sub 1 +2k sub 2 + ... + mk sub m = m }
  1327. X{ S sub 1 sup { k sub 1 } } over { 1 sup k sub 1 k sub 1 ! } ~
  1328. X{ S sub 2 sup { k sub 2 } } over { 2 sup k sub 2 k sub 2 ! } ~
  1329. X{ S sub m sup { k sub m } } over { m sup k sub m k sub m ! }
  1330. Xright ) z sup m
  1331. X.EN
  1332. X.DE
  1333. X.H 2 "Hanging Caps"
  1334. X.fp 1 PA
  1335. X.fp 3 PB
  1336. X.ta 1i
  1337. X.in +0.6i
  1338. X.ll -0.3i
  1339. X.ti -0.3i
  1340. X\v'1'\s36P\s0\v'-1'ater 
  1341. X.de Xx
  1342. X'in -0.6i
  1343. X..
  1344. X.wh \n(nlu+1.5v Xx
  1345. Xnoster qui est
  1346. Xin caelis scanctificetur nomen tuum; adveniat regnum tuum;
  1347. Xfiat voluntus tua, sicut in caelo, et in terra ...
  1348. XAmen.
  1349. XToo bad I can't read Latin so I don't know what that line meant.
  1350. XBut it should be a good example of INITIAL hanging caps.
  1351. X(AND Palatino...)
  1352. X.fp 1 R
  1353. X.fp 3 B
  1354. X.H 1 "tbl output"
  1355. X.DS
  1356. X.TS
  1357. Xallbox doublebox;
  1358. Xc c c
  1359. Xl l l.
  1360. XCommand    Reference Section    Action
  1361. X
  1362. Xcc    CP    Compiles C programs
  1363. Xcp    C    Copies files
  1364. Xdisk cp    C    Copies archive media
  1365. Xlc    C    Lists files
  1366. Xlogin    M    Access to the system
  1367. Xtroff    CT    Typesets text
  1368. X.TE
  1369. X.DE
  1370. X.DS
  1371. X.TS
  1372. Xbox;
  1373. Xc s s
  1374. Xc | c | c
  1375. Xl | l | n.
  1376. XMajor New York Bridges
  1377. X=
  1378. XBridge    Designer    Length
  1379. X_
  1380. XBrooklyn    JA Roebling    1595
  1381. XManhattan    G Lindenthal    1470
  1382. XWilliamsburg    LL Buck    1600
  1383. X_
  1384. XQueensborough    Palmer &    1182
  1385. X      Hornbostel
  1386. X_
  1387. X        1380
  1388. XTriborough    OH Ammann    _
  1389. X        383
  1390. X_
  1391. XBronx Whitestone    OH Ammann    2300
  1392. XThrogs Neck    OH Ammann    1800
  1393. X_
  1394. XGeorge Washington    OH Ammann    3500
  1395. X.TE
  1396. X.DE
  1397. X.DS
  1398. X.TS
  1399. Xbox;
  1400. XcfB s s s.
  1401. XComposition of Foods
  1402. X_
  1403. X.T&
  1404. Xc | c s s
  1405. Xc | c s s.
  1406. XFood    Percent by Weight
  1407. X\^    _
  1408. X\^    Protein    Fat    Carbo-
  1409. X\^    \^    \^    hydrate
  1410. X_
  1411. X.T&
  1412. Xl | n | n | n.
  1413. XApples    .4    .5    13.0
  1414. XHalibut    18.4    5.2    ...
  1415. XLima beans    7.5    .8    22.o
  1416. XMilk    3.3    4.0    5.0
  1417. XMushrooms    3.5    .4    6.0
  1418. XRye bread    9.0    .6    52.7
  1419. X.TE
  1420. X.DE
  1421. X.H 1 "A Test of Two Column Output"
  1422. X.2C
  1423. X.P
  1424. XThe IBM salesman and the IBM system analyst went to spend 
  1425. Xa weekend in the forest, hunting bear.
  1426. XThey hired a log cabin, and when they got there, took 
  1427. Xtheir backpacks off and put them inside.
  1428. XAt which point the salesman said to the systems analyst:
  1429. X"You unpack while I go and find us a bear."
  1430. XThe analyst finished unpacking and then went and sat 
  1431. Xoutside to await events. He did not have to wait too long.
  1432. XSoon he could hear noises in the forest. The noises got 
  1433. Xnearer - and suddenly there was the salesman, running 
  1434. Xacross the clearing toward the cabin, pursued by one of the 
  1435. Xlargest and most ferocious Brown Bears the analyst had 
  1436. Xever seen.
  1437. X"Open the door! shouted the salesman.
  1438. XThe analyst opened the door.
  1439. XThe salesman ran to the door, suddenly stopped, and 
  1440. Xstepped aside.
  1441. XThe Bear carried by its momentum, continued though the 
  1442. Xdoor and disappeared inside.
  1443. XThe salesman promptly shut the door on it, turned, looked 
  1444. Xat the analyst, and said:
  1445. X"Ok, you skin that one while I go rustle us up another."
  1446. X.P
  1447. XThe IBM salesman and the IBM system analyst went to spend 
  1448. Xa weekend in the forest, hunting bear.
  1449. XThey hired a log cabin, and when they got there, took 
  1450. Xtheir backpacks off and put them inside.
  1451. XAt which point the salesman said to the systems analyst:
  1452. X"You unpack while I go and find us a bear."
  1453. XThe analyst finished unpacking and then went and sat 
  1454. Xoutside to await events. He did not have to wait too long.
  1455. XSoon he could hear noises in the forest. The noises got 
  1456. Xnearer - and suddenly there was the salesman, running 
  1457. Xacross the clearing toward the cabin, pursued by one of the 
  1458. Xlargest and most ferocious Brown Bears the analyst had 
  1459. Xever seen.
  1460. X"Open the door! shouted the salesman.
  1461. XThe analyst opened the door.
  1462. XThe salesman ran to the door, suddenly stopped, and 
  1463. Xstepped aside.
  1464. XThe Bear carried by its momentum, continued though the 
  1465. Xdoor and disappeared inside.
  1466. XThe salesman promptly shut the door on it, turned, looked 
  1467. Xat the analyst, and said:
  1468. X"Ok, you skin that one while I go rustle us up another."
  1469. X.P
  1470. XThe IBM salesman and the IBM system analyst went to spend 
  1471. Xa weekend in the forest, hunting bear.
  1472. XThey hired a log cabin, and when they got there, took 
  1473. Xtheir backpacks off and put them inside.
  1474. XAt which point the salesman said to the systems analyst:
  1475. X"You unpack while I go and find us a bear."
  1476. XThe analyst finished unpacking and then went and sat 
  1477. Xoutside to await events. He did not have to wait too long.
  1478. XSoon he could hear noises in the forest. The noises got 
  1479. Xnearer - and suddenly there was the salesman, running 
  1480. Xacross the clearing toward the cabin, pursued by one of the 
  1481. Xlargest and most ferocious Brown Bears the analyst had 
  1482. Xever seen.
  1483. X"Open the door! shouted the salesman.
  1484. X.1C
  1485. X.CS
  1486. X.TC
  1487. END_OF_FILE
  1488. if test 8315 -ne `wc -c <'ltest.m'`; then
  1489.     echo shar: \"'ltest.m'\" unpacked with wrong size!
  1490. fi
  1491. # end of 'ltest.m'
  1492. fi
  1493. if test -f 'psxlate.c' -a "${1}" != "-c" ; then 
  1494.   echo shar: Will not clobber existing file \"'psxlate.c'\"
  1495. else
  1496. echo shar: Extracting \"'psxlate.c'\" \(5230 characters\)
  1497. sed "s/^X//" >'psxlate.c' <<'END_OF_FILE'
  1498. X/*    Copyright 1985, 1986, 1987, 1988 Chris Lewis
  1499. X        All Rights Reserved
  1500. X
  1501. X    Permission to copy and further distribute is freely given provided 
  1502. X    this copyright notice remains intact and that this software is not 
  1503. X    sold for profit.
  1504. X
  1505. X    Project:    Generic Troff drivers
  1506. X    Module:        psxlate.c
  1507. X    Author:     Chris Lewis
  1508. X    Specs:        Generic Postscript filter (page reversal etc.)
  1509. X */
  1510. X#ifndef    SVR3
  1511. X#ifndef    lint
  1512. Xstatic char SCCSid[] = "@(#)psxlate.c: 1.4 Copyright 89/04/21 11:48:27 Chris Lewis";
  1513. X#endif
  1514. X#else
  1515. X#ident  "@(#)psxlate.c: 1.4 Copyright 89/04/21 11:48:27 Chris Lewis"
  1516. X#endif
  1517. X#include <stdio.h>
  1518. X
  1519. Xint    xlate = 0;
  1520. X#define    MAXPAGE    1000
  1521. X
  1522. Xstruct headers {
  1523. X    char *hptr;
  1524. X    struct headers *next;
  1525. X};
  1526. X
  1527. Xstruct pagedesc {
  1528. X    unsigned long start;
  1529. X    unsigned long end;
  1530. X    char *type;
  1531. X    struct headers *comments;
  1532. X} pageidx[MAXPAGE];
  1533. X
  1534. Xchar *tmp = "/tmp/psxXXXXXX";
  1535. Xint page = 0;
  1536. Xchar *progname;
  1537. Xint debug;
  1538. X
  1539. Xmain(argc, argv)
  1540. Xint argc; char **argv; {
  1541. X    extern int optind;
  1542. X    int c;
  1543. X    progname = argv[0];
  1544. X    while ((c = getopt(argc, argv, "drx")) != EOF)
  1545. X    switch(c) {
  1546. X        case 'r': xlate = 0; break;
  1547. X        case 'x': xlate = 1; break;
  1548. X        case 'd': debug = 1; break;
  1549. X        default:
  1550. X        usage();
  1551. X        exit(1);
  1552. X    }
  1553. X    mktemp(tmp);
  1554. X    scan(stdin, tmp);
  1555. X    transform();
  1556. X    emit(tmp);
  1557. X    if (!debug)
  1558. X    cleanup();
  1559. X    exit(0);
  1560. X}
  1561. X
  1562. Xscan(f, file)
  1563. XFILE *f; char *file; {
  1564. X    FILE *t;
  1565. X    extern char *malloc();
  1566. X    int state = 1;
  1567. X    long ind = 0;
  1568. X    int c;
  1569. X    char buf[100];
  1570. X    if ((t = fopen(file, "w")) == NULL) {
  1571. X    fprintf(stderr, "Cannot open temporary file %s\n", file);
  1572. X    exit(1);
  1573. X    }
  1574. X    page = 0;
  1575. X    while((c = getc(f)) != EOF) {
  1576. X    putc(c, t);
  1577. X    ind++;
  1578. X    switch(state) {
  1579. X        case 0:
  1580. X        if (c == '\n') {
  1581. X            state = 1;
  1582. X        }
  1583. X        break;
  1584. X        case 1:    /* seen \n */
  1585. X        if (c == '%') {
  1586. X            fgets(buf, sizeof(buf), f);
  1587. X            fputs(buf, t);
  1588. X            if (0 == strncmp(buf, "!PS-Adobe", 9) ||
  1589. X            0 == strncmp(buf, "%Page:", 6) ||
  1590. X            0 == strncmp(buf, "%Trailer", 8)) {
  1591. X            if (page)
  1592. X                pageidx[page-1].end = ind - 2;
  1593. X            pageidx[page].start = ind - 1;
  1594. X            strcpy(pageidx[page].type = malloc(strlen(buf)+1), buf);
  1595. X            add(page, buf);
  1596. X            page++;
  1597. X            } else
  1598. X            add(page, buf);
  1599. X            ind += strlen(buf);
  1600. X            break;
  1601. X        }
  1602. X        state = 0;
  1603. X        break;
  1604. X    }
  1605. X    }
  1606. X    if (page)
  1607. X    pageidx[page-1].end = ind - 1;
  1608. X    fclose(t);
  1609. X}
  1610. X
  1611. Xcleanup() {
  1612. X    unlink(tmp);
  1613. X}
  1614. X
  1615. Xemit(file)
  1616. Xchar *file; {
  1617. X    FILE *t;
  1618. X    register int i;
  1619. X    if ((t = fopen(file, "r")) == NULL) {
  1620. X    fprintf(stderr, "Panic\n");
  1621. X    exit(1);
  1622. X    }
  1623. X    for(i = 0; i < page; i++) {
  1624. X    register long start, end, cnt;
  1625. X    register int c;
  1626. X
  1627. X    start = pageidx[i].start;
  1628. X    end = pageidx[i].end;
  1629. X    cnt = end - start + 1;
  1630. X    fseek(t, start, 0);
  1631. X    while(cnt--)
  1632. X        putchar(getc(t));
  1633. X    }
  1634. X}
  1635. X
  1636. X
  1637. Xusage() {
  1638. X    fprintf(stderr, "Usage: %s [-r|-x] < file > file\n", progname);
  1639. X}
  1640. X
  1641. Xdumppg() {
  1642. X    register int i;
  1643. X    register struct headers *h;
  1644. X    if (debug) {
  1645. X    for (i = 0; i < page; i++) {
  1646. X        fprintf(stderr, "%d %d %d %s\n", i, pageidx[i].start, 
  1647. X        pageidx[i].end, pageidx[i].type);
  1648. X        for (h = pageidx[i].comments; h; h=h->next)
  1649. X        fprintf(stderr, "%s", h->hptr);
  1650. X    }
  1651. X    }
  1652. X}
  1653. X
  1654. Xtransform() {
  1655. X    dumppg();
  1656. X    switch(xlate) {
  1657. X    case 0:
  1658. X        revpages();
  1659. X        break;
  1660. X    case 1:
  1661. X        xpages();
  1662. X        break;
  1663. X    }
  1664. X    dumppg();
  1665. X}
  1666. X
  1667. Xfstart() {
  1668. X    register int i;
  1669. X    for (i = 0; i < page; i++)
  1670. X    if (0 == strncmp(pageidx[i].type, "%Page:", 6))
  1671. X        break;
  1672. X    return(i);
  1673. X}
  1674. Xfend() {
  1675. X    register int i;
  1676. X    for (i = page-1; i >= 0; i--)
  1677. X    if (0 == strncmp(pageidx[i].type, "%Page:", 6))
  1678. X        break;
  1679. X    return(i);
  1680. X}
  1681. X
  1682. Xrevpages() {
  1683. X    register int i, j;
  1684. X    struct pagedesc t;
  1685. X    i = fstart();
  1686. X
  1687. X    if (i == page)
  1688. X    return;
  1689. X    
  1690. X    j = fend();
  1691. X
  1692. X    while(i < j) {
  1693. X    t = pageidx[i];
  1694. X    pageidx[i] = pageidx[j];
  1695. X    pageidx[j] = t;
  1696. X    i++;j--;
  1697. X    }
  1698. X}
  1699. X
  1700. Xxpages() {
  1701. X    register int i, j, mid, first, last;
  1702. X    struct pagedesc t;
  1703. X    struct pagedesc *p = 
  1704. X    (struct pagedesc *) malloc(sizeof(struct pagedesc) * page);
  1705. X    revpages();
  1706. X    first = fstart();
  1707. X
  1708. X    if (first == page)
  1709. X    return;
  1710. X    
  1711. X    last = fend();
  1712. X
  1713. X    if (debug)
  1714. X    fprintf(stderr, "first: %d, last: %d, page: %d\n", first, last, page);
  1715. X    if ((last - first + 1) < 3)
  1716. X    return;
  1717. X
  1718. X    if (first)
  1719. X    memcpy(p, pageidx, sizeof(struct pagedesc) * first);    /* prolog */
  1720. X    if (page - last)    /* copy epilog */
  1721. X    memcpy(p+last+1, 
  1722. X        &pageidx[last+1], sizeof(struct pagedesc) * (page - last - 1));
  1723. X    mid = (last + first + 1) / 2 ;    /* offset of middle */
  1724. X    for (i = first; i < mid; i++)
  1725. X    p[first + (i - first) * 2] = pageidx[i];
  1726. X    for (i = mid; i <= last; i++)
  1727. X    p[first + (i - mid) * 2 + 1] = pageidx[i];
  1728. X    memcpy(pageidx, p, sizeof(struct pagedesc) * page);
  1729. X    free(p);
  1730. X}
  1731. X
  1732. Xadd(page, buf)
  1733. Xint page; char *buf; {
  1734. X    struct headers *hdr, *hp, *ohp;
  1735. X    char *p;
  1736. X    if (debug)
  1737. X    fprintf(stderr, "Adding %s\n", buf);
  1738. X    hdr = (struct headers *) malloc(sizeof(struct headers));
  1739. X    if (hdr == 0 || !(hdr->hptr = malloc(strlen(buf) + 2))) {
  1740. X    fprintf(stderr, "psxlate: Out of space\n");
  1741. X    exit(1);
  1742. X    }
  1743. X    strcpy(hdr->hptr, "%");
  1744. X    strcat(hdr->hptr, buf);
  1745. X    hdr->next = NULL;
  1746. X    for (ohp = hp = pageidx[page].comments; ; hp = hp->next) {
  1747. X    if (!hp) {
  1748. X        if (ohp == pageidx[page].comments)
  1749. X        pageidx[page].comments = hdr;
  1750. X        else
  1751. X        ohp->next = hdr;
  1752. X        break;
  1753. X    }
  1754. X    ohp = hp;
  1755. X    }
  1756. X    return;
  1757. X}
  1758. END_OF_FILE
  1759. if test 5230 -ne `wc -c <'psxlate.c'`; then
  1760.     echo shar: \"'psxlate.c'\" unpacked with wrong size!
  1761. fi
  1762. # end of 'psxlate.c'
  1763. fi
  1764. if test -f 'showfont.sh' -a "${1}" != "-c" ; then 
  1765.   echo shar: Will not clobber existing file \"'showfont.sh'\"
  1766. else
  1767. echo shar: Extracting \"'showfont.sh'\" \(3197 characters\)
  1768. sed "s/^X//" >'showfont.sh' <<'END_OF_FILE'
  1769. X:
  1770. X#@(#)showfont 1.3 89/08/25
  1771. X# Shell script to dump postscript fonts with widths into a pretty table
  1772. X
  1773. X(
  1774. Xcat << !END!
  1775. X%! PS-Adobe 1.0
  1776. X%%Title: showfont -- displays the font metrics in a pretty one page table
  1777. X%%Creator: Ken Marchant
  1778. X%%CreationDate: March 1989
  1779. X%%Pages: atend
  1780. X%%
  1781. X!END!
  1782. X
  1783. Xif [ -r $1 ]
  1784. Xthen
  1785. X    cat $1
  1786. X    shift
  1787. Xfi
  1788. Xcat << !END!
  1789. X
  1790. X/FONTname ($1) def
  1791. X
  1792. X%%  Setup functions used and etc...
  1793. X
  1794. X/rowmove {
  1795. X  /I exch def 
  1796. X  I 16 mod 30 mul 72 add
  1797. X  680 I 16 idiv 30 mul sub
  1798. X  moveto 
  1799. X} def
  1800. X
  1801. X/widths 259 array def
  1802. X/heights 259 array def
  1803. X/lbear 259 array def
  1804. X/rbear 259 array def
  1805. X/tmp 1 string def
  1806. X.5 setlinewidth
  1807. X
  1808. X/Helvetica findfont 9 scalefont setfont
  1809. X
  1810. X%% Draw the grid around the cells 
  1811. X%% and add the hex labels to the outside of the box
  1812. X
  1813. X0 1 16
  1814. X{
  1815. X    /i exch def
  1816. X    /j i 30 mul def
  1817. X    %% vertical lines
  1818. X    j 62 add dup 220 moveto
  1819. X    700 lineto
  1820. X    stroke
  1821. X
  1822. X    %% horizontal lines
  1823. X    j 220 add dup 62 exch moveto
  1824. X    542 exch lineto
  1825. X    stroke
  1826. X
  1827. X    i 16 ge { clear exit } if
  1828. X
  1829. X    %% hex across the top
  1830. X    j 77 add dup 705 moveto
  1831. X    i 16 (   ) cvrs show
  1832. X
  1833. X    %% hex along the sides
  1834. X    50 670 j sub 12 add moveto 
  1835. X    i 16 (   ) cvrs show
  1836. X}
  1837. Xfor
  1838. X
  1839. X/myscale {
  1840. X    2 mul 
  1841. X    % 10 mul round cvi 10 div
  1842. X    round cvi
  1843. X} def
  1844. X
  1845. X/irmove {
  1846. X    CY add exch
  1847. X    CX add exch moveto
  1848. X} def
  1849. X
  1850. X%% Print out the headings in the font to be displayed and Times-Roman
  1851. X
  1852. X/Times-Roman findfont 18 scalefont setfont
  1853. X295 FONTname stringwidth pop .5 mul sub 750 moveto FONTname show
  1854. X
  1855. XFONTname findfont 18 scalefont setfont
  1856. X295 FONTname stringwidth pop .5 mul sub 730 moveto FONTname show
  1857. X
  1858. X
  1859. X%% loop thru all the charcters and display in 18 point
  1860. X%% insert the character widths into the widths array
  1861. X        0 1 258 
  1862. X        { 
  1863. X         newpath
  1864. X         /i exch def
  1865. X         i rowmove
  1866. X         i 255 gt {
  1867. X         i 256 eq { /tmp (ff) def } if
  1868. X         i 257 eq { /tmp (ffi) def } if
  1869. X         i 258 eq { /tmp (ffl) def } if
  1870. X         } {
  1871. X         /tmp 1 string def
  1872. X         tmp 0 i put
  1873. X         } ifelse
  1874. X         tmp show 
  1875. X         widths i tmp stringwidth pop dup /width exch def 
  1876. X         myscale put 
  1877. X
  1878. X         %    Set current point again.
  1879. X         i rowmove
  1880. X         /curx currentpoint pop def
  1881. X
  1882. X         % retrieve bounding box info.
  1883. X         tmp false charpath flattenpath pathbbox
  1884. X         /ury exch def
  1885. X         /urx exch def
  1886. X         /lly exch def
  1887. X         /llx exch def
  1888. X
  1889. X         % calc left bearing as leftx - curx
  1890. X
  1891. X         lbear i llx curx sub myscale put
  1892. X
  1893. X         % calc height as upper y - lower y
  1894. X
  1895. X         heights i ury lly sub myscale put
  1896. X
  1897. X         % calc right bearing as width - upper x
  1898. X
  1899. X         rbear i width urx curx sub sub myscale put
  1900. X
  1901. X        } 
  1902. X        for 
  1903. X
  1904. X%% display the widths in the widths array
  1905. X
  1906. X    /Helvetica-Narrow findfont 5 scalefont setfont
  1907. X
  1908. X        0 1 258 
  1909. X        { 
  1910. X         /i exch def
  1911. X
  1912. X         i rowmove
  1913. X
  1914. X         currentpoint /CY exch def /CX exch def
  1915. X
  1916. X         2 -8 irmove
  1917. X         widths i get (       ) cvs show 
  1918. X
  1919. X         -9 4 irmove
  1920. X         heights i get (       ) cvs show 
  1921. X
  1922. X         -9 -8 irmove 
  1923. X         lbear i get (       ) cvs show 
  1924. X
  1925. X         12 -8 irmove
  1926. X         rbear i get (       ) cvs show
  1927. X
  1928. X         -9 15 irmove
  1929. X         i 8 (   ) cvrs show
  1930. X
  1931. X         1 15 irmove
  1932. X         i 10 (   ) cvrs show
  1933. X
  1934. X         12 15 irmove
  1935. X         i 16 (   ) cvrs show
  1936. X        }
  1937. X        for
  1938. X
  1939. X    showpage
  1940. X
  1941. X%%Pages: 1
  1942. X!END!
  1943. Xecho '\004'
  1944. X) | rlp -dgate!AppleLaser
  1945. END_OF_FILE
  1946. if test 3197 -ne `wc -c <'showfont.sh'`; then
  1947.     echo shar: \"'showfont.sh'\" unpacked with wrong size!
  1948. fi
  1949. # end of 'showfont.sh'
  1950. fi
  1951. if test -f 'troff2ps.1' -a "${1}" != "-c" ; then 
  1952.   echo shar: Will not clobber existing file \"'troff2ps.1'\"
  1953. else
  1954. echo shar: Extracting \"'troff2ps.1'\" \(5942 characters\)
  1955. sed "s/^X//" >'troff2ps.1' <<'END_OF_FILE'
  1956. X.\"Copyright 1988 by Chris Lewis 1.3 89/04/21
  1957. X.TH TROFF2PS 1 local
  1958. X.SH NAME
  1959. Xtroff2ps, troff2lj, troff2xx \- convert troff output to Postscript, HP etc.
  1960. X.SH SYNOPSIS
  1961. X.BI /usr/lib/troff2/troff2 xx
  1962. X[-D] 
  1963. X.RI "[-d" xx "]"
  1964. X.RI "[-l" length "]"
  1965. X[-V] [-m]
  1966. X.SH DESCRIPTION
  1967. X.I Troff2ps
  1968. Xtakes
  1969. X.I troff
  1970. Xoutput on standard input and transforms it into another format for
  1971. Xoutput on a printer.
  1972. XThis program is normally invoked by
  1973. X.BR psroff(1L),
  1974. Xwhich has a more complete description of how to use some of the more
  1975. Xinteresting features of this program.
  1976. X.P
  1977. XThe output format is determined by how
  1978. X.I troff2ps
  1979. Xis invoked.
  1980. XNormally,
  1981. X.I troff2ps
  1982. Xwill generate PostScript output, but if the
  1983. X.I troff2ps
  1984. Xprogram has been linked to another name, the program will
  1985. Xcheck the trailing two characters in the name it was invoked by to find
  1986. Xout what format should be generated.
  1987. XIf the trailing two characters are "lj", it will generate HP Laserjet
  1988. Xcodes (that is, providing your system administrator hasn't disabled
  1989. Xit).
  1990. XYour system administrator (or the original author of this program) may
  1991. Xmake other output options available from time to time.
  1992. X.P
  1993. XThe
  1994. X.BI -l length
  1995. Xoption is used to tell the software how long the pages are on the printer.
  1996. XThe default value is 11 inches.
  1997. XLength should be written as if you were issuing a ".pl" 
  1998. X.I troff 
  1999. Xcommand; eg: troff scaling should be used.
  2000. XFor example: "-l11i", "-l4752u", "-l792p" specify a page length of
  2001. X11 inches in inches,
  2002. X.I troff
  2003. Xunits and points respectively.
  2004. X.P
  2005. XThe
  2006. X.BI -d xx
  2007. Xoption can be used to override the format determined by looking at the
  2008. Xlast two characters of how 
  2009. X.I troff2ps 
  2010. Xwas invoked.
  2011. XFor example, "troff2ps -dlj" will generate Laserjet output.
  2012. X.P
  2013. XThe
  2014. X.B -D
  2015. Xoption generates scads of diagnostic output in a file called "diagnostics"
  2016. Xin the current directory.
  2017. XWarning: this file has been known to grow over a megabyte on less than 10
  2018. Xpages, so be careful.
  2019. X.P
  2020. XThe
  2021. X.B -V
  2022. Xoption causes
  2023. X.I troff2ps
  2024. Xto print a version message and quit.
  2025. X.P
  2026. XA trailer page of statistics can be generated by using the
  2027. X.B -m
  2028. Xoption provided that the driver supports it.
  2029. X.SH "SPECIAL REQUESTS"
  2030. X.BI troff2 xx
  2031. Xsupports a number of additional features over and above bare
  2032. X.IR troff .
  2033. XThe file tmac.t2 contains a series of macro definitions, 
  2034. X(these macros are recommended for use as a replacement for "-mm" with
  2035. X.IR psroff )
  2036. Xcontains a macro called "\fB.sR\fP".
  2037. XThis macro is used to send special requests to the printer driver.
  2038. XThe macro is invoked with the following arguments:
  2039. X.sp
  2040. X.nf
  2041. X\&.sR "<func><arg><arg>..."
  2042. X.fi
  2043. X.sp
  2044. X.P
  2045. XWhere 
  2046. X.I func 
  2047. Xis a single letter function code.
  2048. X.I arg 
  2049. Xis an argument to the function - the number of arguments a function
  2050. Xtakes is dependent on the function.
  2051. X.ta 1.2i
  2052. X.in +1.2i
  2053. X.ti -1i
  2054. XFunction    Meaning
  2055. X.sp
  2056. X.ti -1i
  2057. XO<name>    Overlay - use "name" as the name of an overlay file.
  2058. XMore than one can be specified by separating by blanks.
  2059. XThe overlay is typically a name from the printer-specific library.
  2060. XEg: "Confidential" is the name for the confidential overlay.
  2061. XNot supported in Laserjet driver.
  2062. X.sp
  2063. X.ti -1i
  2064. XFna    Switch troff font (n) 1..4 to driver font (a) A..O.
  2065. XSupported by Laserjet filter inasmuch as the LJ doesn't download fonts.
  2066. X.sp
  2067. X.ti -1i
  2068. XI<file>    Include the file specified as the single argument into the driver
  2069. Xoutput.
  2070. XThe driver type is appended onto the end of the file name.
  2071. XEg: with the Postscript driver,
  2072. X".sR Ifoo"
  2073. Xbecomes an inclusion of "foo.ps".
  2074. X.RI troff2 xx
  2075. Xwill read the file from the current directory if it exists there, otherwise
  2076. Xfrom the troff2 library directory.
  2077. X.sp
  2078. XThese are not
  2079. X.I troff
  2080. Xinclusions - they are interpreted only by
  2081. X.RI troff2 xx.
  2082. XThis is how the libraries are loaded.
  2083. XSee the section on libraries on how to write library files.
  2084. X.sp
  2085. X.ti -1i
  2086. Xi    Same as "I", except that no translations are done whatsover,
  2087. Xallowing you to enter binary files in the driver's output stream.
  2088. X.sp
  2089. X.ti -1i
  2090. XB    Bin selection.
  2091. XNot supported yet, but stubs exist.
  2092. X.in -1.2i
  2093. X.SH "LIBRARY FILES"
  2094. X.I Troff2ps
  2095. Xsupports the inclusion of printer-specific files both through explicit
  2096. Xinclusions in your
  2097. X.I troff
  2098. Xfiles, as well as including a standard prolog in a printer-independent
  2099. Xfashion.
  2100. X.I troff2xx
  2101. Xloads the file
  2102. X.RI lib. xx ,
  2103. Xwhere
  2104. X.I xx
  2105. Xis the printer type selected.
  2106. XEg: "lib.ps" for PostScript, or "lib.lj" for LaserJet.
  2107. XWith an include directive (either "I" or "i" with ".sR"), 
  2108. X.I troff2xx
  2109. Xwill append the suffix to the file name before searching for the file.
  2110. X.P
  2111. XFiles are searched for in the current directory first, then the
  2112. X.I troff2xx
  2113. Xlibrary directory second.
  2114. X.P
  2115. XThe scanning of normal include files is done by stripping all comments
  2116. X(prefixed by "%") and all whitespace (in lj driver, not neccessary for
  2117. XPostScript).
  2118. XSee the comment in the lib.lj file for more details.
  2119. XWithin the lib files you can recursively include other files as well by
  2120. Xusing "%%%include filename".
  2121. X.P
  2122. XThe "i" include form (.sR macro) or "%%%binclude filename" form (inside
  2123. Xa library file) does the same thing, except that the file included is
  2124. Xsimply copied, no translations are done.
  2125. X.SH FILES
  2126. X.if t .ta 2i
  2127. X.if n .ta 3i
  2128. X/usr/lib/troff2    Troff2ps library directory
  2129. X.br
  2130. X/usr/lib/troff2/*.ps    Postscript libraries
  2131. X.br
  2132. X/usr/lib/troff2/*.lj    HP Laserjet libraries
  2133. X.SH BUGS
  2134. XDue to the nature by which special sequences are transmitted by
  2135. Xtroff (stderr, forced into stdin by
  2136. X.IR psroff ),
  2137. Xnormal troff errors will not be seen and may generate a few
  2138. X"invalid opcode" messages from troff2ps.
  2139. XNormally the document will be truncated if this occurs.
  2140. XIf this happens, run
  2141. X.I troff
  2142. Xwith the same arguments you gave to
  2143. X.I psroff
  2144. Xexcept that you should redirect the standard output to /dev/null, and
  2145. Xgive the "-t" option.
  2146. X.P
  2147. XUnfortunately, there is no way at present for the ".sR" macro to
  2148. Xchange fonts within a line - for some pretty bizarre reasons if you ask
  2149. Xme.
  2150. XNever mind.
  2151. XAsk me if you want more information.
  2152. X.SH "SEE ALSO"
  2153. Xtroff(1), psroff(1L).
  2154. X.SH AUTHOR
  2155. XChris Lewis (...lsuc!gate!eci386!clewis or clewis@eci386)
  2156. END_OF_FILE
  2157. if test 5942 -ne `wc -c <'troff2ps.1'`; then
  2158.     echo shar: \"'troff2ps.1'\" unpacked with wrong size!
  2159. fi
  2160. # end of 'troff2ps.1'
  2161. fi
  2162. echo shar: End of archive 3 \(of 6\).
  2163. cp /dev/null ark3isdone
  2164. MISSING=""
  2165. for I in 1 2 3 4 5 6 ; do
  2166.     if test ! -f ark${I}isdone ; then
  2167.     MISSING="${MISSING} ${I}"
  2168.     fi
  2169. done
  2170. if test "${MISSING}" = "" ; then
  2171.     echo You have unpacked all 6 archives.
  2172.     echo "Read README to install psroff"
  2173.     rm -f ark[1-9]isdone
  2174. else
  2175.     echo You still need to unpack the following archives:
  2176.     echo "        " ${MISSING}
  2177. fi
  2178. ##  End of shell archive.
  2179. exit 0
  2180.  
  2181.